import type { MockMethod } from 'vite-plugin-mock'
// @ts-ignore
import Mock from "mockjs";

export default [
  {
    url: '/mock/api/user/login',
    method: 'post',
    response: ({ body }) => {
      return {
        code: 0,
        msg: '登录成功',
        data: {
          token: Mock.mock('@id'),
        }
      }
    }
  },
  {
    url: '/mock/api/user/validate_codes',
    method: 'post',
    response: ({ body }) => {
      return {
        code: 0,
        msg: '登录成功',
        data: {
          token: Mock.mock('@id'),
        }
      }
    }
  },
  {
    url: '/mock/api/user/info',
    method: 'post',
    response: ({ body }) => {
      return {
        code: 0,
        msg: null,
        data: {
          created_at: Mock.mock('@date(yyyy-MM-dd hh:mm:ss)'),
          updated_at: Mock.mock('@date(yyyy-MM-dd hh:mm:ss)'),
          email: Mock.mock('@email'),
          id: Mock.mock('@id'),
          name: Mock.mock('@cname'),
          avatar: Mock.mock('@image(200x200, #FF4D4F, avatar)'),
        }
      }
    }
  }
] as MockMethod[]
